# eric7.Graphics.SvgDiagram

Module implementing a dialog showing a SVG graphic.

### Global Attributes

None

### Classes

SvgDiagram | Class implementing a dialog showing a SVG graphic.

### Functions

None

## SvgDiagram

Class implementing a dialog showing a SVG graphic.

### Derived from

EricMainWindow

### Class Attributes

ZoomLevelDefault
ZoomLevels

### Class Methods

None

### Methods

SvgDiagram | Constructor
__adjustScrollBar | Private method to adjust a scrollbar by a certain factor.
__doZoom | Private method to set the zoom value in percent.
__initActions | Private method to initialize the view actions.
__initContextMenu | Private method to initialize the context menu.
__initToolBars | Private method to populate the toolbars with our actions.
__levelForZoom | Private method determining the zoom level index given a zoom factor.
__loadSvgFile | Private method to load a given SVG file.
__print | Private slot to the actual printing.
__printDiagram | Private slot called to print the diagram.
__printPreviewDiagram | Private slot called to show a print preview of the diagram.
__showContextMenu | Private slot to show the context menu of the listview.
__zoom | Private method to get the current zoom factor in percent.
__zoomIn | Private method to zoom into the SVG.
__zoomOut | Private method to zoom out of the SVG.
__zoomReset | Private method to reset the zoom value.
event | Public method handling events.
gestureEvent | Protected method handling gesture events.
getDiagramName | Public method to retrieve a name for the diagram.
wheelEvent | Protected method to handle wheel events.

### Static Methods

None

#### SvgDiagram (Constructor)

SvgDiagram(svgFile, parent=None, name=None)

Constructor

svgFile (str)
  filename of a SVG graphics file to show
parent (QWidget)
  parent widget of the view
name (str)
  name of the view widget

#### SvgDiagram.__adjustScrollBar

__adjustScrollBar(scrollBar, factor)

Private method to adjust a scrollbar by a certain factor.

scrollBar (QScrollBar)
  reference to the scrollbar object
factor (float)
  factor to adjust by

#### SvgDiagram.__doZoom

__doZoom(value)

Private method to set the zoom value in percent.

value (int)
  zoom value in percent

#### SvgDiagram.__initActions

__initActions()

Private method to initialize the view actions.

#### SvgDiagram.__initContextMenu

__initContextMenu()

Private method to initialize the context menu.

#### SvgDiagram.__initToolBars

__initToolBars()

Private method to populate the toolbars with our actions.

#### SvgDiagram.__levelForZoom

__levelForZoom(zoom)

Private method determining the zoom level index given a zoom factor.

zoom (int)
  zoom factor

Return:
  index of zoom factor

Return Type:
  int

#### SvgDiagram.__loadSvgFile

__loadSvgFile(svgFile)

Private method to load a given SVG file.

svgFile (str)
  file path of the SVG file

#### SvgDiagram.__print

__print(printer)

Private slot to the actual printing.

printer (QPrinter)
  reference to the printer object

#### SvgDiagram.__printDiagram

__printDiagram()

Private slot called to print the diagram.

#### SvgDiagram.__printPreviewDiagram

__printPreviewDiagram()

Private slot called to show a print preview of the diagram.

#### SvgDiagram.__showContextMenu

__showContextMenu(coord)

Private slot to show the context menu of the listview.

coord (QPoint)
  the position of the mouse pointer

#### SvgDiagram.__zoom

__zoom()

Private method to get the current zoom factor in percent.

Return:
  current zoom factor in percent

Return Type:
  int

#### SvgDiagram.__zoomIn

__zoomIn()

Private method to zoom into the SVG.

#### SvgDiagram.__zoomOut

__zoomOut()

Private method to zoom out of the SVG.

#### SvgDiagram.__zoomReset

__zoomReset()

Private method to reset the zoom value.

#### SvgDiagram.event

event(evt)

Public method handling events.

evt (QEvent)
  reference to the event

Return:
  flag indicating, if the event was handled

Return Type:
  bool

#### SvgDiagram.gestureEvent

gestureEvent(evt)

Protected method handling gesture events.

evt (QGestureEvent)
  reference to the gesture event

#### SvgDiagram.getDiagramName

getDiagramName()

Public method to retrieve a name for the diagram.

Return:
  name for the diagram

Return Type:
  str

#### SvgDiagram.wheelEvent

wheelEvent(evt)

Protected method to handle wheel events.

evt (QWheelEvent)
  reference to the wheel event

Up